<?php
require_once ('../../src/db/connectdatabase.php');
require_once ("../dao/IntrodutionDAO.php");
require_once('../../src/control/RedirectForward.php');

$url = "admin/admin.php?c=gioi-thieu";

if(isset($_POST['acc'])) {
	$act = $_POST['acc'];
	if ($act == "editintro") {
		if(isset($_POST['textfieldcontent'])) {
			$id = 'gioi-thieu';
			$content = $_POST['textfieldcontent'];
			$update = updateIntro($id, $content);
			
			if($update == true) {
				$url .= "&mess=success";
			} else {
				$url .= "&mess=error";
			}
		}
	} else {
		$url .= "&mess=error";
	}
}  else {
	$url .= "&mess=error";
}
redirect($url);
?>